import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import Layout from '@/layout/Layout.vue'

//配置项
const routes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
  },
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    redirect: '/home/goods',
    component: Layout,
    children: [
      {
        path: '/home/goods',
        component: () => import('@/views/goods'),
      },
      {
        path: '/home/comment',
        component: () => import('@/views/comment'),
      },
      {
        path: '/home/shop',
        component: () => import('@/views/shop'),
      },
    ],
  },
  {
    path: '/detail',
    component: () => import('@/views/detail'),
  },
  // {
  //   path: '/goods',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '',
  //       component: () => import('@/views/goods'),
  //     },
  //   ],
  // },
  // {
  //   path: '/comment',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '',
  //       component: () => import('@/views/comment'),
  //     },
  //   ],
  // },
  // {
  //   path: '/shop',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '',
  //       component: () => import('@/views/shop'),
  //     },
  //   ],
  // },
]

//创建实例
const router = new VueRouter({
  routes,
})

//导出实例
export default router
